home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Extras / Networking / SANA-II / slip_src / ip.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-17  |  5.0 KB  |  138 lines

  1. /*      @(#)ip.h 1.13 88/08/19 SMI; from UCB 7.6.1.1 3/15/88    */
  2.  
  3. /*
  4.  * Copyright (c) 1982, 1986 Regents of the University of California.
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms are permitted
  8.  * provided that this notice is preserved and that due credit is given
  9.  * to the University of California at Berkeley. The name of the University
  10.  * may not be used to endorse or promote products derived from this
  11.  * software without specific prior written permission. This software
  12.  * is provided ``as is'' without express or implied warranty.
  13.  */
  14.  
  15. /*
  16.  * Definitions for internet protocol version 4.
  17.  * Per RFC 791, September 1981.
  18.  */
  19.  
  20. #ifndef _netinet_ip_h
  21. #define _netinet_ip_h
  22.  
  23. #define IPVERSION       4
  24. #define mc68000 1
  25.  
  26. /*
  27.  * Structure of an internet header, naked of options.
  28.  *
  29.  * We declare ip_len and ip_off to be short, rather than u_short
  30.  * pragmatically since otherwise unsigned comparisons can result
  31.  * against negative integers quite easily, and fail in subtle ways.
  32.  */
  33. struct ip {
  34. #if defined(vax) || defined(i386)
  35.         u_char  ip_hl:4,                /* header length */
  36.                 ip_v:4;                 /* version */
  37. #endif
  38. #if defined(mc68000) || defined(sparc)
  39.         u_char  ip_v:4;                 /* version */
  40.         u_char  ip_hl:4;                /* header length */
  41. #endif
  42.         u_char  ip_tos;                 /* type of service */
  43.         u_short ip_len;                 /* total length */
  44.         u_short ip_id;                  /* identification */
  45.         short   ip_off;                 /* fragment offset field */
  46. #define IP_DF 0x4000                    /* dont fragment flag */
  47. #define IP_MF 0x2000                    /* more fragments flag */
  48.         u_char  ip_ttl;                 /* time to live */
  49.         u_char  ip_p;                   /* protocol */
  50.         u_short ip_sum;                 /* checksum */
  51.         struct  in_addr ip_src,ip_dst;  /* source and dest address */
  52. };
  53.  
  54. #define IP_MAXPACKET    65535           /* maximum packet size */
  55.  
  56. /*
  57.  * Definitions for options.
  58.  */
  59. #define IPOPT_COPIED(o)         ((o)&0x80)
  60. #define IPOPT_CLASS(o)          ((o)&0x60)
  61. #define IPOPT_NUMBER(o)         ((o)&0x1f)
  62.  
  63. #define IPOPT_CONTROL           0x00
  64. #define IPOPT_RESERVED1         0x20
  65. #define IPOPT_DEBMEAS           0x40
  66. #define IPOPT_RESERVED2         0x60
  67.  
  68. #define IPOPT_EOL               0               /* end of option list */
  69. #define IPOPT_NOP               1               /* no operation */
  70.  
  71. #define IPOPT_RR                7               /* record packet route */
  72. #define IPOPT_TS                68              /* timestamp */
  73. #define IPOPT_SECURITY          130             /* provide s,c,h,tcc */
  74. #define IPOPT_LSRR              131             /* loose source route */
  75. #define IPOPT_SATID             136             /* satnet id */
  76. #define IPOPT_SSRR              137             /* strict source route */
  77.  
  78. /*
  79.  * Offsets to fields in options other than EOL and NOP.
  80.  */
  81. #define IPOPT_OPTVAL            0               /* option ID */
  82. #define IPOPT_OLEN              1               /* option length */
  83. #define IPOPT_OFFSET            2               /* offset within option */
  84. #define IPOPT_MINOFF            4               /* min value of above */
  85.  
  86. /*
  87.  * Time stamp option structure.
  88.  */
  89. #ifdef    IP_TIME
  90.  
  91. struct  ip_timestamp {
  92.         u_char  ipt_code;               /* IPOPT_TS */
  93.         u_char  ipt_len;                /* size of structure (variable) */
  94.         u_char  ipt_ptr;                /* index of current entry */
  95. #if defined(vax) || defined(i386)
  96.         u_char  ipt_flg:4,              /* flags, see below */
  97.                 ipt_oflw:4;             /* overflow counter */
  98. #endif
  99. #if defined(mc68000) || defined(sparc)
  100.         u_short ipt_oflw:4;             /* overflow counter */
  101.         u_short ipt_flg:4;              /* flags, see below */
  102. #endif
  103.         union ipt_timestamp {
  104.                 n_long  ipt_time[1];
  105.                 struct  ipt_ta {
  106.                         struct in_addr ipt_addr;
  107.                         n_long ipt_time;
  108.                 } ipt_ta[1];
  109.         } ipt_timestamp;
  110. };
  111.  
  112. #endif
  113.  
  114. /* flag bits for ipt_flg */
  115. #define IPOPT_TS_TSONLY         0               /* timestamps only */
  116. #define IPOPT_TS_TSANDADDR      1               /* timestamps and addresses */
  117. #define IPOPT_TS_PRESPEC        2               /* specified modules only */
  118.  
  119. /* bits for security (not byte swapped) */
  120. #define IPOPT_SECUR_UNCLASS     0x0000
  121. #define IPOPT_SECUR_CONFID      0xf135
  122. #define IPOPT_SECUR_EFTO        0x789a
  123. #define IPOPT_SECUR_MMMM        0xbc4d
  124. #define IPOPT_SECUR_RESTR       0xaf13
  125. #define IPOPT_SECUR_SECRET      0xd788
  126. #define IPOPT_SECUR_TOPSECRET   0x6bc5
  127.  
  128. /*
  129.  * Internet implementation parameters.
  130.  */
  131. #define MAXTTL          255             /* maximum time to live (seconds) */
  132. #define IPFRAGTTL       60              /* time to live for frags, slowhz */
  133. #define IPTTLDEC        1               /* subtracted when forwarding */
  134.  
  135. #define IP_MSS          576             /* default maximum segment size */
  136.  
  137. #endif /*!_netinet_ip_h*/
  138.